import {
  Controller,
  Inject,
  Get,
  Query,
  Body,
  Post,
  Param,
  Del,
} from '@midwayjs/core';
import { DropsService } from '@service/jx3/drops.service';
import { ListDropsDTO } from '@dto/jx3/drops.dto';
import { BusinessType, Log } from '@decorator/log.decorator';

@Controller('/jx3/drops')
export class PostController {
  @Inject()
  DropsService: DropsService;

  // 获取列表
  @Get('/list')
  async list(@Query() queryParams: ListDropsDTO) {
    return await this.DropsService.list(queryParams);
  }

  // 新增
  @Log({ title: '副本掉落新增', businessType: BusinessType.ADD })
  @Post('/add')
  async create(@Body() Drops: any) {
    return await this.DropsService.create(Drops);
  }

  // 删除
  @Log({ title: '副本掉落删除', businessType: BusinessType.REMOVE })
  @Del('/:DropsId')
  async delete(@Param('DropsId') DropsId: string) {
    return await this.DropsService.delete(DropsId);
  }

  // 修改
  @Log({ title: '副本掉落修改', businessType: BusinessType.EDIT })
  @Post('/update')
  async update(@Body() Drops: any) {
    return await this.DropsService.update(Drops);
  }

  // 获取副本掉落详情
  @Get('/:DropsId')
  async get(@Param('DropsId') DropsId: string) {
    return await this.DropsService.detail(DropsId);
  }
}
